package API005;

import java.io.File;

public class FileDemo05 {
    public static void main(String[] args) {
        File src = new File("d:\\");
        findTxt(src);
    }
    public static void findTxt(File src) {
        File[] listFiels = src.listFiles();
        if(listFiels != null){
            for(File file : listFiels){
                if (file.isFile()) {
                    String name = file.getName();
                    if (name.endsWith(".jpg")) {
                        System.out.println(file);
                    }
                } else {
                    findTxt(file);
                }
            }
        }
    }
}
